package com.daemon;

import com.sun.jmx.snmp.tasks.ThreadService;

public class PollExecution {
    public static void main(String[] args) {
        PollExecution.runTask();
    }


    public static void runTask() {
        final long timeInterval = 120000;// 两分钟运行一次
       // final long timeInterval = 10000;// 两分钟运行一次
        Runnable runnable = new Runnable() {
            public void run() {
                while (true) {
                    // ------- code for task to run
                    System.out.println("守护进程自我检测了1次");
                    Process.logic();
//你要运行的程序
                    // ------- ends here
                    try {
                        Thread.sleep(timeInterval);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        Thread thread = new Thread(runnable);
        thread.start();
    }
}
